﻿/*-------------------------------------------------------------------------
* 命名空间: WaferSelectV3.Models/SlaveStateModel
* 类       名: SlaveStateModel
* 功      能:  TD
* 时      间:  2024-05-14 15:27:55
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace WaferSelectV3.Models
{
    public class SlaveStateModel : BindableBase
    {
        private int _id;

        public int Id
        {
            get { return _id; }
            set
            {
                _id = value;
                RaisePropertyChanged();
            }
        }


        private string? _slaveName;

        public string? SlaveName
        {
            get { return _slaveName; }
            set
            {
                _slaveName = value;
                RaisePropertyChanged();
            }
        }

        private string? _slaveIp;

        public string? SlaveIp
        {
            get { return _slaveIp; }
            set
            {
                _slaveIp = value;
                RaisePropertyChanged();
            }
        }

        private int _slavePort;

        public int SlavePort
        {
            get { return _slavePort; }
            set
            {
                _slavePort = value;
                RaisePropertyChanged();
            }
        }

        private bool _isOnline;

        /// <summary>
        /// 是否在线
        /// </summary>
        public bool IsOnline
        {
            get { return _isOnline; }
            set
            {
                _isOnline = value;
                if (_isOnline)
                {
                    ConnectedColor = new SolidColorBrush(Colors.Green);
                }
                {
                    ConnectedColor = new SolidColorBrush(Colors.Red);
                }
            }
        }


        private SolidColorBrush? _connectedColor;
        /// <summary>
        /// 是否在线对应的颜色
        /// </summary>
        public SolidColorBrush? ConnectedColor
        {
            get { return _connectedColor; }
            set
            {
                _connectedColor = value;
                RaisePropertyChanged();
            }
        }

        private int _disConnectedCount;
        /// <summary>
        /// 累积连接失败次数
        /// </summary>
        public int DisConnectedCount
        {
            get { return _disConnectedCount; }
            set { _disConnectedCount = value; }
        }

        private bool _readyStatus;
        /// <summary>
        /// 服务是否开启,是否准备连接
        /// </summary>
        public bool ReadyStatus
        {
            get { return _readyStatus; }
            set
            {
                _readyStatus = value;
                RaisePropertyChanged();
            }
        }

    }
}
